package com.zhima.controller.plain;

import com.zhima.dto.ZhimaOjResult;
import com.zhima.service.OjContestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.zhima.dto.ZhimaOjResult.success;

@RestController
@RequestMapping("/contest-score-board")
public class OjContestScoreBoardController {
    @Autowired
    private OjContestService ojContestService;

    /**
     * 根据{contestId}获取排行榜
     *
     * @param contestId
     * @return
     */
    @GetMapping("/{contestId}")
    public ZhimaOjResult getContestScoreBoardByContestId(@PathVariable("contestId") Long contestId) {
        return success(ojContestService.getContestScoreBoardByContestId(contestId));
    }
}
